package hangban.com.maochang.impl;


import hangban.com.maochang.dao.AirInfoAllDao;
import hangban.com.maochang.pojo.AirInfo;
import hangban.com.maochang.util.BaseDao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class AirInfoAllDaoImpl extends BaseDao implements AirInfoAllDao {


    @Override
    public List<AirInfo> getSelectAll() {
            String sql="select * from Airinfo";
        ResultSet rs = super.query(sql, null);
        List<AirInfo> list=new ArrayList<>();
        try {
            while (rs.next()){
                AirInfo airInfo=new AirInfo();
                airInfo.setId(rs.getInt("id"));
                airInfo.setHangcard(rs.getInt("hangcard"));
                airInfo.setMudi(rs.getString("mudi"));
                airInfo.setDatefei(rs.getDate("datefei"));
                list.add(airInfo);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            try {
                closeAll(rs.getStatement().getConnection(), rs.getStatement(), rs);
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return list;
    }
}
